package com.yun.zf.app.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yun.zf.app.mapper.ZfHouseInfoMapper;
import com.yun.zf.app.service.ZfHouseInfoRentService;
import com.yun.zf.app.service.ZfHouseInfoSaleService;
import com.yun.zf.app.service.ZfHouseInfoService;
import com.yun.zf.common.admin.model.house.HouseInfo;
import com.yun.zf.common.app.domain.ZfHouseInfo;
import com.yun.zf.common.app.domain.ZfHouseInfoRent;
import com.yun.zf.common.app.domain.ZfHouseInfoSale;
import com.yun.zf.common.mapstruct.admin.HouseMapper;
import com.yun.zf.system.utils.EsRestUtil;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 买卖租售维护信息表 服务实现类
 * </p>
 *
 * @author cj
 * @since 2021-03-01
 */
@Service
@Log
public class ZfHouseInfoServiceImpl extends ServiceImpl<ZfHouseInfoMapper, ZfHouseInfo> implements ZfHouseInfoService {

    @Autowired
    private EsRestUtil esRestUtil;

    @Autowired
    private ZfHouseInfoRentService rentService;
    @Autowired
    private ZfHouseInfoSaleService saleService;

    /**
     * 获取房源信息
     */
    @Override
    public ZfHouseInfo getHouseInfoById(Long basicId, Long provinceCode, Long cityCode) {
        QueryWrapper<ZfHouseInfo> houseInfoQueryWrapper = new QueryWrapper<>();
        houseInfoQueryWrapper.lambda().eq(ZfHouseInfo::getCityCode, cityCode)
                .eq(ZfHouseInfo::getProvinceCode, provinceCode)
                .eq(ZfHouseInfo::getBasicId, basicId);
        return  baseMapper.selectOne(houseInfoQueryWrapper);
    }

}
